<?php ob_start();
include("header.php" );
validate_user();
//Submit Artical ///////////////////////////////////////////////////
if(isset($_POST['title'])&&($_POST['title']!="")){ 
	$base_name = basename($_FILES['fetured_image']['name']);
	$photos='';
	if($base_name!="" && $_FILES['fetured_image']['error']==0 && $_FILES['fetured_image']['size']<(1024*1024)/2){
		$path="uploads/";
		$thumb_folder_path = "uploads/thumb/";
		$tt=time();
		$target_path=$path.$tt.$base_name;
		$thumb_target_path = $thumb_folder_path."t_".$tt.$base_name;
		$photo=$tt.$base_name;
		$photos =" `fetured_image` = '".$photo."', "; 
		if(move_uploaded_file($_FILES['fetured_image']['tmp_name'],$target_path)){
     		$image = new SimpleImage();
			$image->load($target_path);
			$image->resize(500,500);
			$image->save($thumb_target_path);
		}
	}
	$sql=mysql_query("INSERT INTO `my_article` SET `article_title`='".addslashes($_POST['title'])."',$photos
												   `article_discription`='".addslashes($_POST['artical'])."',
												   `user_id`='".$_SESSION['id']."',
												   `url_id`='".$_SESSION['url_id']."'
												   ")or die(mysql_error());
	if($sql){
		header("location:create_page_step4.php"); exit;
	}
}
/////////////////////////////////////////////////////////////
if(isset($_SESSION['url_id'])){ $url=get_allitem('my_business_url','id',$_SESSION['url_id']); }
?>

<!--Body Section start-->
<div class="body_div" style="margin: 0 auto; float:none;">
<div class="create_page_head">

<div id="url">
    <h1><span>http://www.mycitydial.com/<?php if(isset($url['url'])){ echo cut_text($url['url'],75);} ?></span>
     <input type="text" class="long_box" value="<?php if(isset($url['url'])){ echo cut_text($url['url'],75);} ?>" style="width:400px" />
    </h1>
    <input type="hidden" id="urlid" value="<?php if(isset($url['id'])){ echo $url['id'];} ?>" />
    <a href="javascript:;" id="urledit">+Edit</a><span id='msg' style='color:red;'></span>
</div> 
 </div>

<!--Create page Steps div start-->
<div class="steps_div">
<div class="steps">
 <ul>
<li><a href="#" class="current">
<div>
<img src="images/steps/1_black.png" />
<img src="images/steps/1.png" />
<span>Home Page</span>
</div>
</a></li>

<li><a href="#" class="current">
<div>
<img src="images/steps/02.png" />
<img src="images/steps/2.png" />
<span>Page Gallery</span>
</div>
</a></li>

<li><a href="#"  class="active">
<div>
<img src="images/steps/03.png" />
<img src="images/steps/3.png" />
<span>About Page</span>
</div>
</a></li>

<li><a href="#">
<div>
<img src="images/steps/4_black.png" />
<img src="images/steps/4.png" />
<span>Owner Profile </span>
</div>
</a></li>
</ul>
</div>
<ul id="output2">
 

<!--.......................-->
 
<!--.......................-->

<li>

<div class="header_navi"> 
  <h2>Post Promotion Article for Your Page</h2>
  <div class="btn"> 
    <div style="position:absolute; right:12px" class="alerti"> Please fill Compleate article </div>
    <div class="nextprev">
     <a href="create_page_step2.php"><img src="images/prev.png"  /></a>
<a href="create_page_step4.php"><img src="images/next.png"  /></a>     
    </div>

    <div class="nextstep"><a href="create_page_step4.php" id="btnstep3" class="inputbtn">Save and Next</a></div>
    
  </div>
  
</div>
<form action="" method="post" enctype="multipart/form-data" id="artical_form">
<div class="setps_form_heading">
<?php $artical=get_allitem('my_article','url_id',$_SESSION['url_id']);?>
<div class="artical_name">
<span>Artical Title</span>
<input name="title" type="text" class="artical_name_box" 
value="<?php  if(isset($artical['article_title'])){ echo $artical['article_title']; }else{ echo "Write your Article Title Here!"; } ?>" />
</div>

<div class="artical_bt">
<span>Featured Images</span>
<div id="file_browse_wrapper" style="margin-left:0px;">
<a  href="#" class="inputbtn" onclick="$('#file_browse').click()" >Upload Image</a>
<input name="fetured_image" id="file_browse" type="file" style="display:none" />
</div>
</div>
</div>

<div class="artical_new">
<script type="text/javascript"  src="editor/ckeditor.js"></script>
<script>
$(function(){ CKEDITOR.replace( 'editor1' ); });
	
</script>
<textarea name="artical" class="textarea"    id="editor1" style="border: 1px #C7E0E3 solid"><?php if(isset($artical['article_discription'])){ echo $artical['article_discription'];} ?></textarea> 
</div>
</form>
</li>
<!--.......................-->

 

</ul>
</div>
<!--Create page Steps div end-->
<br clear="all" />
<br clear="all" />
</div>
<? include("footer.php");  ?>

